﻿namespace ChinaUnicom.Web
{
    using Avatar.Log;
    using System;

    internal static class Extensions
    {
        public static void TryCall(this Action<HttpStatus> callback, HttpStatus status)
        {
            if (callback != null)
            {
                try
                {
                    callback(status);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            }
        }

        public static string Named(this HttpMethod method)
        {
            return method.ToString("G");
        }
    }
}
